#include <iostream>
#include <unordered_map>
using namespace std;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  long long K, sum = 0, ans = 0;
  unordered_map<long long, int> sum_map;

  cin >> n >> K;
  sum_map[0]++;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    sum += a;
    ans += sum_map[sum - K];
    sum_map[sum]++;
  }
  cout << ans << "\n";
  return 0;
}